package com.changgou.goods.feign;

import com.changgou.goods.pojo.Sku;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@FeignClient(name = "goods")
@RequestMapping(value = "/sku")
public interface SkuFeign {
    /**
     查询Sku全部数据；要在父模块中导入对common公共工具类的依赖
     */
    @GetMapping("/status/{status}")
    Result<List<Sku>> findByStatus(@PathVariable String status);

    /**
     * 根据条件搜索
     * @param sku
     * @return
     */
    @PostMapping(value="/search")       //根据SpuID查询Sku集合
    Result<List<Sku>> findList(@RequestBody(required = false) Sku sku);

    //根据spu_id查询对应的sku集合
    @GetMapping("/spu/{id}")
    Result<List<Sku>> findBySpuId(@PathVariable Long id);
    /**
     * 根据spuid删除对应的sku
     */
    @DeleteMapping("/deleteAll/{id}")
    Result deleteAllSkuBySpuId(@PathVariable Long id);
}
